﻿Imports UndirectedGraphs
Imports System.IO

Module Module1

    Sub Main()

        Dim g As New Graph("f:\temp\tinyG.txt")
        Dim s As Integer = 5

        'Dim search As New DepthFirstSearch(g, s)

        'For v As Integer = 0 To g.V - 1

        '    If search.is_marked(v) Then
        '        Console.WriteLine(v.ToString() + " ")
        '    End If

        'Next

        'If search.return_count <> g.V Then
        '    Console.WriteLine("NOT connected")
        'Else
        '    Console.WriteLine("connected")
        'End If

        Dim bfs As New BreadthFirstPaths(g, s)
        For v As Integer = 0 To g.V - 1
            If bfs.hasPathTo(v) Then
                Console.WriteLine(s.ToString() + " to " + v.ToString() + ": " + bfs.distanceTo(v).ToString())
                For Each x As Integer In bfs.PathTo(v)
                    If x = s Then
                        Console.WriteLine(x.ToString())
                    Else
                        Console.WriteLine("- " + x.ToString())
                    End If
                Next
            Else
                Console.WriteLine(s.ToString() + " not connected to " + v.ToString())
            End If
        Next

    End Sub

End Module
